﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.IO;
using GameServer.Tools;
using GameServer.Events;

namespace GameServer
{
    public class ClientListener
    {
        private TcpListener MainSocket;
        private Server Server;

        public ClientListener(TcpListener tcl, Server s)
        {
            this.MainSocket = tcl;
            this.Server = s;
        }

        public void run()
        {
            while (MainSocket.Server.IsBound)
            {
                Server.Clients.Add(new Client(MainSocket.AcceptTcpClient(), Server));
            }
            Logger.Log(LevelType.CRITICAL, "Exited player listen loop.");
        }
    }
}
